﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Open_MUD.Mudlib.lib.Loc.Mapas;

namespace Open_MUD.Mudlib.lib.Loc
{
    class MapHandler
    {
        private static MapHandler __instance = null;
        private Dictionary<string, Map> mapas = new Dictionary<string, Map>();
        private Object Lock = new Object();        

        public MapHandler()
        {
            Continente c ;
            c=new Continente();
            string id = "westeros";
            c.CreateMap(id,"/Data/maps/"+id+"/",1300,3000);
            AddMapa(id, c);
        }

        public static MapHandler getInstance()
        {
            if (__instance == null)
                __instance = new MapHandler();
            return __instance;
        }

        public Map getMapa(string id)
        {
            if (mapas.ContainsKey(id))
                return mapas[id];
            else
                return null;
        }

        protected void AddMapa(string id,Map m)
        {           
            if (!mapas.ContainsKey(id))
            {                
                mapas.Add(id,m);
            }
        }
    }
}
